[#include "../../../common/html.ftl" /]
[@html]
    [@head title="添加字典数据" css=["fw"] /]
    [@body]
        [@formMain ]
            <div class="fw-forms">
                [@dataForm formId="form-dictData-add" ]
                    <div class="am-form-group am-u-sm-12 am-u-md-6 am-u-lg-4">
                        <label class="is-required">字典标签：</label>
                        <input class="am-form-field am-radius" type="text" name="dictLabel" required />
                    </div>
                    <div class="am-form-group am-u-sm-12 am-u-md-6 am-u-lg-4">
                        <label class="is-required">字典键值：</label>
                        <input class="am-form-field am-radius" type="text" name="dictValue" required />
                    </div>
                    <div class="am-form-group am-u-sm-12 am-u-md-6 am-u-lg-4">
                        <label class="is-required">字典排序：</label>
                        <input class="am-form-field am-radius" type="text" name="dictSort" required />
                    </div>
                    <div class="am-form-group am-u-sm-12 am-u-md-6 am-u-lg-4">
                        <label>字典类型：</label>
                        <input class="am-form-field am-radius" type="text" name="dictType" value="${dictType}" readonly />
                    </div>
                    <div class="am-form-group am-u-sm-12 am-u-md-6 am-u-lg-4">
                        <label>样式属性：</label>
                        <input class="am-form-field am-radius" type="text" name="cssClass" />
                    </div>
                    <div class="am-form-group am-u-sm-12 am-u-md-6 am-u-lg-4">
                        <label>回显样式：</label>
                        <select class="am-radius" name="listClass" title="table表格字典列显示样式属性" >
                            <option value="">-- 请选择 --</option>
                            <option value="default">默认</option>
                            <option value="primary">主要</option>
                            <option value="success">成功</option>
                            <option value="secondary">信息</option>
                            <option value="warning">警告</option>
                            <option value="danger">危险</option>
                        </select>
                    </div>
                    <div class="am-form-group am-u-sm-12 am-u-md-6 am-u-lg-4">
                        <label class="is-required">系统默认：</label>
                        <select class="am-radius" name="isDefault" required >
                            <option value="">-- 请选择 --</option>
                            [#list dict.getType("sys_yes_no") as dict]
                                <option value="${dict.dictValue}">${dict.dictLabel}</option>
                            [/#list]
                        </select>
                    </div>
                    <div class="am-form-group am-u-sm-12 am-u-md-6 am-u-lg-4">
                        <label class="is-required">状态：</label>
                        <select class="am-radius" name="status" required >
                            <option value="">-- 请选择 --</option>
                            [#list dict.getType("sys_dict_status") as dict]
                                <option value="${dict.dictValue}">${dict.dictLabel}</option>
                            [/#list]
                        </select>
                    </div>
                    <div class="am-form-group am-u-sm-12 am-u-md-6 am-u-lg-4">
                        <label class="is-required">是否系统内置：</label>
                        <select class="am-form-field am-radius" name="buildIn" required>
                            <option value="">-- 请选择 --</option>
                            [#list dict.getType("sys_yes_no") as dict]
                                <option value="${dict.dictValue}">${dict.dictLabel}</option>
                            [/#list]
                        </select>
                    </div>
                    <div class="am-form-group am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <label>备注：</label>
                        <textarea class="am-radius" name="remark" rows="5" ></textarea>
                    </div>
                [/@dataForm]
            </div>
        [/@formMain]

        <!-- PC/APP 右侧悬浮按钮 -->
        [@rightToolbar /]

        [@script js=["fw", "validate"] progress="false" ]
            <script type="text/javascript">
                var prefix = ctx + "osfw/system/dict/data";

                $("#form-dictData-add").validate({
                    rules:{
                        dictLabel: {
                            maxlength: 100,
                        },
                        dictValue: {
                            maxlength: 100,
                        },
                        cssClass: {
                            maxlength: 100,
                        },
                        configName: {
                            maxlength: 100,
                        },
                        dictSort:{
                            digits:true,
                            maxlength: 4,
                        },
                        remark:{
                            maxlength: 500,
                        },
                    },
                    onkeyup: false,
                    focusCleanup: true
                });

                function submitHandler() {
                    if($.validate.form()) {
                        $.operate.save(prefix + "/add", $('#form-dictData-add').serialize());
                    }
                }
            </script>
        [/@script]
    [/@body]
[/@html]